package com.imooc.ecommerce.feign;

import com.imooc.ecommerce.vo.CommonResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * Sentinel对openFeign接口的降级策略
 * @author zhangshao
 * @since 2023/12/7 20:38
 */
@Slf4j
@Component
public class SentinelFeignClientFallback implements SentinelFeignClient{
    @Override
    public CommonResponse<String> getResultByFeign(Integer code) {
        log.error("request supply for test hash some error: [{}]",code);
        return new CommonResponse<>(
                -1,
                "Sentinel feign fallback",
                "input code: "+code);
    }
}
